//
//  BDMapAnnotationView.m
//  iOS_beboy
//
//  Created by wen on 2017/11/16.
//  Copyright © 2017年 com.8xiong. All rights reserved.
//

#import "BDMapAnnotationView.h"

@implementation BDMapAnnotationView

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    if (self.selected == selected || self.needShowImage == NO) {
        return;
    }
    if (selected) {
        if (self.calloutImageView == nil) {
            /* Construct custom callout. */
            self.calloutImageView = [[UIImageView alloc] init];
            self.calloutImageView.frame = CGRectMake(0, 0, 31, 34);
            self.calloutImageView.image = [UIImage imageNamed:@"spot.png"];
            self.calloutImageView.center = CGPointMake(CGRectGetWidth(self.bounds) / 2.f + self.calloutOffset.x,                                                   -CGRectGetHeight(self.calloutImageView.bounds) / 2.f + self.calloutOffset.y);
        }
        [self addSubview:self.calloutImageView];
    }else{
        [self.calloutImageView removeFromSuperview];
    }
    [super setSelected:selected animated:animated];
}

@end
